package com.boc.ewr.util.file.enumeration;

import com.boc.ewr.bcimp.controller.*;
import com.boc.ewr.bcimp.entity.*;
import com.boc.ewr.bcimp.service.impl.*;
import com.boc.ewr.risk.controller.IntranetCaFdbkController;
import com.boc.ewr.risk.entity.IntranetCaFdbk;
import com.boc.ewr.risk.service.impl.IntranetCaFdbkServiceImpl;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

@Slf4j
public enum ImportEnum {

    //未回清单	CA_UNRTN_LIST
    CA_UNRTN_LIST("CUL1", CaUnrtnList.class, CaUnrtnListServiceImpl.class, "未回清单", null),
    //特殊不对账清单	CA_UNPRIACC_LIST
    CA_UNPRIACC_LIST("CUL2", CaUnpriaccList.class, CaUnpriaccListServiceImpl.class, "特殊不对账清单", null),
    //剔除考核账户	ACCT_ELMT_ASSMT
    ACCT_ELMT_ASSMT("AEA3", AcctElmtAssmt.class, AcctElmtAssmtServiceImpl.class, "剔除考核账户", AcctElmtAssmtController.class),
    //高风险客户号	ACCT_HGRSK_CUSM
    ACCT_HGRSK_CUSM("AHC4", AcctHgrskCusm.class, AcctHgrskCusmServiceImpl.class, "高风险客户号", AcctHgrskCusmController.class),
    //智能催收会话明细	COLL_CALL_LIST
    COLL_CALL_LIST("CCL5", CollCallList.class, CollCallListServiceImpl.class, "智能催收会话清单", CollCallListController.class),
    //余额对账单明细	CA_BAL_DTL
    CA_BAL_DTL("CBD6", CaBalDtl.class, CaBalDtlServiceImpl.class, "余额对账单明细", null),
    //上门服务账户清单（交易银行部）-上门收款/上门服务账户清单（交易银行部）-收送单	CORP_DTD_COLL
    //CORP_DTD_COLL("CDC7", CorpDtdColl.class, CorpDtdCollServiceImpl.class, "上门服务账户清单（交易银行部）-上门收款/上门服务账户清单（交易银行部）-收送单", CorpDtdCollController.class),
    //已有特殊不对账账户	HAD_ACCT_UNPRIACC
    //HAD_ACCT_UNPRIACC("HAU8", HadAcctUnpriacc.class, HadAcctUnpriaccServiceImpl.class, "已有特殊不对账账户", null),
    //已有上门服务账户	HAD_ACCT_DTD
    HAD_ACCT_DTD("HAD9", HadAcctDtd.class, HadAcctDtdServiceImpl.class, "已有上门服务账户", HadAcctDtdController.class),
    //已有可剔除考核账户	HAD_ACCT_ELMTB_ASSMT
    //HAD_ACCT_ELMTB_ASSMT("HAEA10", HadAcctElmtbAssmt.class, HadAcctElmtbAssmtServiceImpl.class,"已有可剔除考核账户", HadAcctElmtbAssmtController.class),
    //已有D2类账户	HAD_ACCT_D2
    HAD_ACCT_D2("HAD11", HadAcctD2.class, HadAcctD2ServiceImpl.class, "已有D2类账户", HadAcctD2Controller.class),
    //回执查询清单	CA_RTN_LIST
    CA_RTN_LIST("CRL12", CaRtnList.class, CaRtnListServiceImpl.class, "回执查询清单", null),
    //外网对账数据	CA_EXTRANET_LIST
    CA_EXTRANET_LIST("CEL13", CaExtranetList.class, CaExtranetListServiceImpl.class, "外网对账数据", null),
    //MAC地址报备表	MAC_ADDR_RPT
    MAC_ADDR_RPT("MAR14", MacAddrRpt.class, MacAddrRptServiceImpl.class, "MAC地址报备表", MacAddrRptController.class),
    //对公客户网银操作员信息（交易银行部）	CORP_EBK_TLR
    CORP_EBK_TLR("CET15", CorpEbkTlr.class, CorpEbkTlrServiceImpl.class, "对公客户网银操作员信息（交易银行部）", CorpEbkTlrController.class),
    //CASS柜员信息	CASS_TLR_MSG
    CASS_TLR_MSG("CTM16", CassTlrMsg.class, CassTlrMsgServiceImpl.class, "CASS柜员信息", null),
    //长期未对账账户明细	ACCT_LNGTM_UNCA_DTL
    ACCT_LNGTM_UNCA_DTL("ALUD17", AcctLngtmUncaDtl.class, AcctLngtmUncaDtlServiceImpl.class, "长期未对账账户明细", null),
    //员工信息(人力资源)	HR_EMP_INFO
    HR_EMP_INFO("HEI18", HrEmpInfo.class, HrEmpInfoServiceImpl.class, "员工信息(人力资源)", HrEmpInfoController.class),
    //小额非重点账户	ACCT_SMALL_UNIMP
    ACCT_SMALL_UNIMP("ASU19", AcctSmallUnimp.class, AcctSmallUnimpServiceImpl.class, "小额非重点账户", null),
    //不符重点关注清单	SIGN_MISMATCH_FOCUS_LIST
    SIGN_MISMATCH_FOCUS_LIST("SMFL20", SignMismatchFocusList.class, SignMismatchFocusListServiceImpl.class, "不符重点关注清单", null),
    //OCR已上交账单清单	OCR_HANDED_LIST
    OCR_HANDED_LIST("OHL21", OcrHandedList.class, OcrHandedListServiceImpl.class, "OCR已上交账单清单", null),
    //账单投递明细表	CA_SEND_DTL
    CA_SEND_DTL("CSD22", CaSendDtl.class, CaSendDtlServiceImpl.class, "账单投递明细表", CaSendDtlController.class),
    //对账地址范围设定表	CA_ADDRRG_LIST
    CA_ADDRRG_LIST("CAL23", CaAddrrgList.class, CaAddrrgListServiceImpl.class, "对账地址范围设定表", CaAddrrgListController.class),
    //标签库	CUSM_TAG_LIST
    CUSM_TAG_LIST("CTL24", CusmTagList.class, CusmTagListServiceImpl.class, "标签库列表", CusmTagListController.class),
    //企查查-工商信息	QCC_BUS_INFO
    QCC_BUS_INFO("QBI25_1", QccBusInfo.class, QccBusInfoServiceImpl.class, "企查查-工商信息", QccBusInfoController.class),
    //企查查-经营状况统计	QCC_OPRT_STA
    QCC_OPRT_STA("QOS25_2", QccOprtSta.class, QccOprtStaServiceImpl.class, "企查查-经营状况统计", QccOprtStaController.class),
    //企查查-经营风险统计	QCC_OPRT_RISK
    QCC_OPRT_RISK("QOR25_3", QccOprtRisk.class, QccOprtRiskServiceImpl.class, "企查查-经营风险统计", QccOprtRiskController.class),
    //企查查-法律风险统计	QCC_LAW_RISK
    QCC_LAW_RISK("QLR25_4", QccLawRisk.class, QccLawRiskServiceImpl.class, "企查查-法律风险统计", QccLawRiskController.class),
    //内网对账数据    INTRANET_CA_FDBK
    INTRANET_CA_FDBK("ICF26", IntranetCaFdbk.class, IntranetCaFdbkServiceImpl.class, "内网对账数据", null),
    //高风险法人清单    HGRSK_LGL_RPST
    HGRSK_LGL_RPST("HLR27", HgrskLglRpst.class, HgrskLglRpstServiceImpl.class, "高风险法人清单", HgrskLglRpstController.class),
    //节假日清单 HOLIDAY_LIST
    HOLIDAY_LIST("HL28", HolidayList.class, HolidayListServiceImpl.class, "节假日清单", HolidayListController.class),
    //账单信息确认表
    OUTSRC_BILL_INFO_CNFM("OBIC29", OutsrcBillInfoCnfm.class, OutsrcBillInfoCnfmServiceImpl.class, "账单信息确认表", OutsrcBillInfoCnfmController.class);

    private String index; //编号
    private Class entityName; //实体类
    private Class serviceName; //服务类
    private String TypeCN; //业务中文名
    private Class controlService; //control类

    ImportEnum(String index, Class entityName, Class serviceName, String TypeCN, Class controlService) {
        this.index = index;
        this.entityName = entityName;
        this.serviceName = serviceName;
        this.TypeCN = TypeCN;
        this.controlService = controlService;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public Class getEntityName() {
        return entityName;
    }

    public void setEntityName(Class entityName) {
        this.entityName = entityName;
    }

    public Class getServiceName() {
        return serviceName;
    }

    public void setServiceName(Class serviceName) {
        this.serviceName = serviceName;
    }

    public String getTypeCN() {
        return TypeCN;
    }

    public void setTypeCN(String typeCN) {
        TypeCN = typeCN;
    }

    public Class getControlService() {
        return controlService;
    }

    public void setControlService(Class controlService) {
        this.controlService = controlService;
    }

    /**
     * 根据code获取枚举对象
     *
     * @param code
     * @return
     */
    public static ImportEnum getByIndex(String code) {
        Optional<ImportEnum> first = Arrays.stream(ImportEnum.values()).filter(e -> e.getIndex().equals(code)).findFirst();
//        ExpEnum expEnum = first.get();
        ImportEnum expEnum = first.orElse(null);
        log.info("导入的文件类型是：" + expEnum.toString());
        return expEnum;
    }

    @Override
    public String toString() {
        return "ImportEnum{" +
                "index='" + index + '\'' +
                ", entityName=" + entityName +
                ", serviceName=" + serviceName +
                ", TypeCN='" + TypeCN + '\'' +
                '}';
    }
}
